# Contributor: Bart Ribbers <bribbers@disroot.org>
# Contributor: Newbyte <newbytee@protonmail.com>
# Maintainer: Bart Ribbers <bribbers@disroot.org>
pkgname=pure-maps
pkgver=3.2.0
pkgrel=3
pkgdesc="Maps and navigation"
url="https://github.com/rinigus/pure-maps"
# armhf blocked by mapbox-gl-qml -> qt5-qtdeclarative-dev
# s390x blocked by mimic1
# ppc64le, riscv64 blocked by luajit -> osmscout-server
arch="all !armhf !ppc64le !s390x !riscv64"
license="GPL-3.0-or-later"
depends="
	geoclue
	kirigami2
	mapbox-gl-qml
	mimic1
	nemo-qml-plugin-dbus
	osmscout-server
	py3-gpxpy
	py3-pyotherside
	qml-module-clipboard
	qmlrunner
	qt5-qtbase-sqlite
	qt5-qtmultimedia
	qt5-qtquickcontrols
	qt5-qtsensors
	"
makedepends="
	cmake
	gettext
	py3-pyflakes
	python3
	qt5-qtbase-dev
	qt5-qtlocation-dev
	qt5-qtquickcontrols2-dev
	qt5-qttools-dev
	s2geometry-dev
	samurai
	"
checkdepends="py3-pytest"
subpackages="$pkgname-lang"
source="https://github.com/rinigus/pure-maps/releases/download/$pkgver/pure-maps-$pkgver.tar.gz"

build() {
	cmake -B build -G Ninja \
		-DCMAKE_BUILD_TYPE=MinSizeRel \
		-DCMAKE_INSTALL_PREFIX=/usr \
		-DFLAVOR="kirigami" \
		-DDEFAULT_PROFILE="offline" \
		-DDEFAULT_FONTPROVIDER="osmscout"
	cmake --build build
}

check() {
	# Disabled as they require API keys to be present and/or an internet connection
	pytest geocoders guides poor routers \
		-k 'not test_geocode and not test_autocomplete_type and not test_nearby and not test_get and not test_autocomplete'
}

package() {
	DESTDIR="$pkgdir" cmake --install build

	# Locales get installed to the wrong location and thus have to be moved
	# to get picked up by abuild lang()
	mv "$pkgdir"/usr/share/pure-maps/locale "$pkgdir"/usr/share
}

lang() {
	default_lang

	amove usr/share/pure-maps/translations
}

sha512sums="
8bc4f37c811126543f49b9250953179dae741c7200d0fc8937818ec6976fa58659f3d2b691c6b5a56a8982cb155141660c306ad3a0ba2de08ff291af24e71f0a  pure-maps-3.2.0.tar.gz
"
